<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : data-result-style.xsl
    Created on : January 18, 2011, 3:03 PM
    Author     : ReutyCheng
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html"/>

  <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
  <xsl:template match="/">
    <html>
      <head>
        <title>Data Result</title>
        <style type="text/css">
          html, body, p, table, td, h1, h2, h3, h4, h5, h6
          {
          padding: 0;
          margin: 0;
          border: none;
          font-family: Arial Unicode MS, Arial, sans-serif;
          font-size: 12pt;
          }
          body
          {
          padding: 5px;
          }
          table
          {
          border: none;
          border-spacing: 0;
          border-collapse: collapse;
          width: 100%;
          }
          tr
          {
          background: #FFFFFF;
          }
          th, td
          {
          padding: 0px 3px;
          line-height: 25px;
          }
          .xmltitle
          {
          }
          .copyright
          {
          color: #FF0000;
          font-style: italic;
          font-size: 10pt;
          margin: 10px 0px;
          text-align: right;
          }
        </style>
      </head>
      <body>
        <div class="xmltitle"></div>

        <xsl:for-each select="ROOT/DATA_XML">
          <div class="data_xml">
            <h3 style="font-size: 15pt;">Metas:</h3>
            <table class="datas">
              <thead>
                <tr class="data">
                  <th>Meta Name</th>
                  <th>Meta Value</th>
                </tr>
              </thead>
              <tbody>
                <xsl:choose>
                  <xsl:when test="count(Metas/Meta) = 0">
                    <tr class="odd">
                      <td class="empty" colspan="2">Empty</td>
                    </tr>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:for-each select="Metas/Meta">
                    <xsl:choose>
                      <xsl:when test="position() mod 2 = 0">
                      <tr class="even">
                        <td style="background: #E0E0E0; text-align: center;"><xsl:value-of select="@metaName" /></td>
                        <td><xsl:value-of select="@metaValue" /></td>
                      </tr>
                      </xsl:when>
                      <xsl:otherwise>
                      <tr class="odd">
                        <td style="background: #E0E0E0; text-align: center;"><xsl:value-of select="@metaName" /></td>
                        <td><xsl:value-of select="@metaValue" /></td>
                      </tr>
                      </xsl:otherwise>
                    </xsl:choose>
                      <tr class="odd">
                        <td style="background: #E0E0E0; text-align: center;"><xsl:value-of select="@metaName" /></td>
                        <td><xsl:value-of select="@metaValue" /></td>
                      </tr>
                    </xsl:for-each>
                  </xsl:otherwise>
                </xsl:choose>
              </tbody>
            </table>
          </div>
        </xsl:for-each>

        <div class="copyright dom_header">By CES</div>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>
